# -*- coding: utf-8 -*-

import sys

from odoo import models


class ProjectTask(models.Model):
    _inherit = 'stock.picking'

    def send_work_config_message(self):
        user_name = self.user_id.name
        user_info = self.env['hr.employee'].search([('name', '=', user_name)])

        # 将所要发送的用户添加至消息模板中
        # send_work_config_message
        function_name = sys._getframe().f_code.co_name  # 获取当前方面的函数名
        # msg_id = self.env['dingtalk.message.config.but'].search([('function', '=', function_name)]).id  # 获取当前模板的 ID 号
        config = self.env['dingtalk.message.config'].search([('id', '=', '4')])
        config.write({'user_ids': user_info})
